
_realname=igraph
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.8.5
pkgrel=1
pkgdesc="Library for the analysis of networks (mingw-w64)"
arch=('any')
url="https://igraph.org"
license=('GPL')
source=(https://github.com/igraph/igraph/releases/download/${pkgver}/igraph-${pkgver}.tar.gz)
sha256sums=('2e5da63a2b8e9bb497893a17cf77c691df1739c298664f8adb1310a01218f95b')
depends=("${MINGW_PACKAGE_PREFIX}-glpk"
         "${MINGW_PACKAGE_PREFIX}-gmp"
         "${MINGW_PACKAGE_PREFIX}-zlib"
         "${MINGW_PACKAGE_PREFIX}-libxml2")
makedepends=(flex bison)


_srcdir=${_realname}-${pkgver}
_builddir=build-${pkgver}-${MINGW_PACKAGE_PREFIX}

prepare() {
  cd ${_srcdir}

  autoreconf -vfi

  # remove the file testsuite in source tree to force 'make check'
  # to generate it from scratch.
  test -f tests/testsuite || rm -f tests/testsuite
}

build() {
  mkdir -p ${_builddir}
  cd ${_builddir}
  ../${_srcdir}/configure -C \
    --enable-tls             \
    YFLAGS=-Wall

  make V=0 || make
}

check() {
  # igraph 0.8.5: all tests succeeded
  make V=0 -C ${_builddir} check TESTSUITEFLAGS=-j
}

package() {
  make -C ${_builddir} DESTDIR="${pkgdir}" install
  install -D -m644 ${_srcdir}/COPYING "${pkgdir}"/${MSYSTEM_PREFIX}/share/licenses/${_realname}/COPYING
}
